<template>
  <div class="tab">
	  <div v-for="(value,index) in title" @click="change(index)" :class="{'active':$store.state[indexName]==index}">
	    {{value}}
	  </div>
  </div>
</template>

<script>
	
  export default{
    name:'',
    data(){
      return {
		  
       }
    },
	props:{
	  title:{
	    type:Array,
	    default(){
	      return []
	    }
	  },
	  indexName:{
		  type:String,
		  default(){
			  return ""
		  }
	  }
	},
    methods:{
      change(i){
        this.$store.state[this.indexName]=i
      }
    },
    components:{
       
    }
  }
</script>

<style scoped>
	.tab{
	  display: flex;
	  text-align: center;
	  background-color: white;
	  
	}
	.tab div{
	  flex: 1;
	  font-size: 18px;
	  line-height: var(--big-height);
	}

	.active{
	  color: white;
	  background-color: var(--bcc-green);
	}
</style>
